<template>
  <div class="app-container">
    <el-card class="box-card">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" >
      <el-form-item label="姓名" prop="username">
        <el-input
          v-model="queryParams.username"
          placeholder="请输入姓名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <!--<el-form-item label="单位" prop="department">
        <el-input
          v-model="queryParams.department"
          placeholder="请输入单位"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>-->
     <!-- <el-form-item label="身份证号" prop="idNumber">
        <el-input
          v-model="queryParams.idNumber"
          placeholder="请输入身份证号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>-->
      <!--<el-form-item label="部门" prop="deptid">
        <el-input
          v-model="queryParams.deptid"
          placeholder="请输入部门"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>-->
      <!--<el-form-item label="事由" prop="causes">
        <el-input
          v-model="queryParams.causes"
          placeholder="请输入事由"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>-->
      <el-form-item label="开始时间" prop="leaveStartTime">
        <el-date-picker clearable
          v-model="queryParams.leaveStartTime"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择开始时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="结束时间" prop="leaveEndTime">
        <el-date-picker clearable
          v-model="queryParams.leaveEndTime"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择结束时间">
        </el-date-picker>
      </el-form-item>
    <!--  <el-form-item label="总状态" prop="leaveTotalState">
        <el-select
          v-model="queryParams.leaveTotalState"
          placeholder="请选择休假审核总状态"
          clearable
        >
          <el-option
            v-for="item in option_leaveTotalState"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
      </el-form-item>-->
        <!--<el-form-item label="销假情况" prop="leaveSituation">
        <el-input
          v-model="queryParams.leaveSituation"
          placeholder="请输入销假情况"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="部门负责人姓名" prop="departmentHeadName">
        <el-input
          v-model="queryParams.departmentHeadName"
          placeholder="请输入部门负责人姓名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="部门负责人身份证号" prop="departmentHeadIdnum">
        <el-input
          v-model="queryParams.departmentHeadIdnum"
          placeholder="请输入部门负责人身份证号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="部门负责人审批结果" prop="departmentHeadResult" v-show="showSearch">
        <el-input
          v-model="queryParams.departmentHeadResult"
          placeholder="请输入部门负责人审批结果"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="部门负责人审批时间" prop="departmentHeadTime">
        <el-date-picker clearable
          v-model="queryParams.departmentHeadTime"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择部门负责人审批时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="部门负责人审批意见" prop="departmentHeadSuggest">
        <el-input
          v-model="queryParams.departmentHeadSuggest"
          placeholder="请输入部门负责人审批意见"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="部门负责人是否代审" prop="departmentHeadIsacting" v-show="showSearch">
        <el-input
          v-model="queryParams.departmentHeadIsacting"
          placeholder="请输入部门负责人是否代审"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="局长姓名" prop="directorGeneralName">
        <el-input
          v-model="queryParams.directorGeneralName"
          placeholder="请输入局长姓名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="局长身份证号" prop="directorGeneralIdnum">
        <el-input
          v-model="queryParams.directorGeneralIdnum"
          placeholder="请输入局长身份证号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="局长审批结果" prop="directorGeneralResult" v-show="showSearch">
        <el-input
          v-model="queryParams.directorGeneralResult"
          placeholder="请输入局长审批结果"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="局长审批时间" prop="directorGeneralTime">
        <el-date-picker clearable
          v-model="queryParams.directorGeneralTime"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择局长审批时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="局长审批意见" prop="directorGeneralSuggest">
        <el-input
          v-model="queryParams.directorGeneralSuggest"
          placeholder="请输入局长审批意见"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="局长是否代审" prop="directorGeneralIsacting" v-show="showSearch">
        <el-input
          v-model="queryParams.directorGeneralIsacting"
          placeholder="请输入局长是否代审"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="政委姓名" prop="politicalCommissarName">
        <el-input
          v-model="queryParams.politicalCommissarName"
          placeholder="请输入政委姓名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="政委身份证号" prop="politicalCommissarIdnum">
        <el-input
          v-model="queryParams.politicalCommissarIdnum"
          placeholder="请输入政委身份证号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="政委审批结果" prop="politicalCommissarResult" v-show="showSearch">
        <el-input
          v-model="queryParams.politicalCommissarResult"
          placeholder="请输入政委审批结果"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="政委审批时间" prop="politicalCommissarTime">
        <el-date-picker clearable
          v-model="queryParams.politicalCommissarTime"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择政委审批时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="政委审批意见" prop="politicalCommissarSuggest">
        <el-input
          v-model="queryParams.politicalCommissarSuggest"
          placeholder="请输入政委审批意见"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="政委是否代审" prop="politicalCommissarIsacting" v-show="showSearch">
        <el-input
          v-model="queryParams.politicalCommissarIsacting"
          placeholder="请输入政委是否代审"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>-->
      <br/>
      <div style="text-align: right;">
          <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery" >搜索</el-button>
          <el-button icon="el-icon-refresh" size="mini" @click="resetQuery" >重置</el-button>
      </div>
    </el-form>
      <br/>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['module:cjl:leave:add']"
        >新增</el-button>
      </el-col>
      <!--<el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['module:cjl:leave:edit']"
        >修改</el-button>
      </el-col>-->
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['module:cjl:leave:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['module:cjl:leave:export']"
        >导出</el-button>
      </el-col>
    </el-row>

    <el-table v-loading="loading" :data="leaveList" border @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column type="index" label="序号" width="55" :index="indexMethod" align="center" />
      <el-table-column label="姓名" align="center" prop="username" />
      <el-table-column label="部门" align="center" prop="dept.deptName" />
      <el-table-column  label="负责人审批结果" align="center" prop="departmentHeadResult" >
        <template slot-scope="scope">
          <span v-if="scope.row.departmentHeadResult==1">通过</span>
          <span v-if="scope.row.departmentHeadResult==2">不通过</span>
        </template>
      </el-table-column>
      <el-table-column label="局长审批结果" align="center" prop="directorGeneralResult" >
      <template slot-scope="scope">
        <span v-if="scope.row.directorGeneralResult==1">通过</span>
        <span v-if="scope.row.directorGeneralResult==2">不通过</span>

      </template>
      </el-table-column>
      <el-table-column label="政委审批结果" align="center" prop="politicalCommissarResult" >
      <template slot-scope="scope">
        <span v-if="scope.row.politicalCommissarResult==1">通过</span>
        <span v-if="scope.row.politicalCommissarResult==2">不通过</span>
      </template>
      </el-table-column>
      <el-table-column label="请假审核总状态" align="center" prop="leaveTotalState" >
      <template slot-scope="scope">
        <span v-if="scope.row.leaveTotalState==0">审核不通过</span>
        <span v-if="scope.row.leaveTotalState==1">待部门审核</span>
        <span v-if="scope.row.leaveTotalState==2">待局长政委审核</span>
        <span v-if="scope.row.leaveTotalState==3">待局长政委审核</span>
        <span v-if="scope.row.leaveTotalState==4">审核通过</span>
      </template>
      </el-table-column>
      <el-table-column label="销假状态" align="center" prop=" leaveSituation" >
        <template slot-scope="scope">
          <span v-if="scope.row.leaveSituation==1">未销假</span>
          <span v-if="scope.row.leaveSituation==2">已销假</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width"  width="200" fixed="right">
        <template slot-scope="scope">
          <el-button
            v-show="scope.row.leaveTotalState==0"
            size="mini"
            type="text"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['module:cjl:leave:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            @click="handleDelete(scope.row)"
            v-hasPermi="['module:cjl:leave:remove']"
          >删除</el-button>
          <el-button
            size="mini"
            type="text"
            @click="handleDetail(scope.row,scope.index)"
            v-hasPermi="['module:cjl:leave:detail']"
          >详细</el-button>
          <el-button
            v-show="scope.row.leaveTotalState==4"
            size="mini"
            type="text"
            @click="handleBack(scope.row,scope.index)"
            v-hasPermi="['module:cjl:leave:back']"
          >销假</el-button>
          <el-button
            size="mini"
            type="text"
            @click="handleView(scope.row,scope.index)"
            v-hasPermi="['module:cjl:leave:view']"
          >单位审核</el-button>
          <el-button
            size="mini"
            type="text"
            @click="handleChief(scope.row,scope.index)"
            v-hasPermi="['module:cjl:leave:chief']"
          >局长审核</el-button>
          <el-button
            size="mini"
            type="text"
            @click="handleGaott(scope.row,scope.index)"
            v-hasPermi="['module:cjl:leave:gaott']"
          >政委审核</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
    </el-card>
    <!-- 添加或修改休假记录对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-container>
          <el-header>
            <el-divider content-position="left">
              <p style="color: #00afff; font-size: 20px;">请假申请基本信息</p>
            </el-divider>
          </el-header>
          <el-main>
            <el-row>
              <el-col :span="12">
                <el-form-item label="开始时间" prop="leaveStartTime">
                  <el-date-picker
                    clearable
                    style="width: 100%"
                    v-model="form.leaveStartTime"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="请选择开始时间">
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="结束时间" prop="leaveEndTime">
                  <el-date-picker
                    clearable
                    style="width: 100%"
                    v-model="form.leaveEndTime"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="请选择结束时间">
                  </el-date-picker>
                </el-form-item>
              </el-col>
            </el-row>
        <el-form-item label="事由" prop="causes">
          <el-input v-model="form.causes" type="textarea" :rows="6" placeholder="请输入内容" maxlength="100"/>
         <!-- <editor v-model="form.causes" :min-height="192" placeholder="请输入事由" />-->
        </el-form-item>
           <!-- <el-row>
            <el-col :span="12">
            <el-form-item label="休假地点" prop="leaveAddress" >
              <el-cascader
                v-model="selectedOptions"
                :options="options"
                filterable
                clearable
                style="width: 380px"
                placeholder="请选择休假地点"
                @change="handleChange"
              />
            </el-form-item>
            </el-col>
            </el-row>-->
          </el-main>
        </el-container>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 查看审核详细休假记录对话框 -->
    <el-dialog :title="detail.title" :visible.sync="detail.open" width="1300px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="150px">
        <el-container>
          <el-header>
            <el-divider content-position="left">
              <p style="color: #00afff; font-size: 20px;">请假申请基本信息</p>
            </el-divider>
          </el-header>
          <el-main>
            <el-row>
              <el-col :span="12">
                <el-form-item label="开始时间" prop="leaveStartTime">
                  <el-date-picker
                    clearable
                    style="width: 100%"
                    v-model="form.leaveStartTime"
                    type="date"
                    value-format="yyyy-MM-dd"
                    readonly="true">
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="结束时间" prop="leaveEndTime">
                  <el-date-picker
                    clearable
                    style="width: 100%"
                    v-model="form.leaveEndTime"
                    type="date"
                    value-format="yyyy-MM-dd"
                    readonly="true">
                  </el-date-picker>
                </el-form-item>
              </el-col>
            </el-row>
            <el-form-item label="事由" prop="causes">
              <el-input v-model="form.causes" type="textarea" :rows="6"  readonly="true"/>
            </el-form-item>
           <!-- <el-form-item label="休假地点" prop="leaveAddress" >
              <el-cascader
                v-model="selectedOptions"
                :options="options"
                filterable
                clearable
                style="width: 460px"
                disabled="true"
                @change="handleChange"
              />
            </el-form-item>-->
          </el-main>
        </el-container>
        <el-container>
          <el-header>
            <el-divider content-position="left">
              <p style="color: #00afff; font-size: 20px;">部门审核</p>
            </el-divider>
          </el-header>
          <el-main>
            <el-row>
              <el-col :span="12">
                <el-form-item label="部门负责人审批结果" prop="departmentHeadResult">
                  <el-select v-model="form.departmentHeadResult" disabled="true" style="width: 100%;">
                    <el-option
                      v-for="item in option_departmentHeadResult"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="部门负责人审批时间" prop="departmentHeadTime">
                  <el-date-picker
                    clearable
                    style="width: 100%"
                    v-model="form.departmentHeadTime"
                    type="date"
                    value-format="yyyy-MM-dd"
                    readonly="true">
                  </el-date-picker>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-form-item label="部门负责人审批意见" prop="departmentHeadSuggest">
                <el-input v-model="form.departmentHeadSuggest" type="textarea" :rows="6"  readonly="true"/>
              <!--  <editor v-model="form.departmentHeadSuggest" :min-height="192"   disabled="true"/>-->
              </el-form-item>
            </el-row>
          </el-main>
        </el-container>
        <el-container>
          <el-header>
            <el-divider content-position="left">
              <p style="color: #00afff; font-size: 20px;">局长审核</p>
            </el-divider>
          </el-header>
          <el-main>
            <el-row>
              <el-col :span="12">
                <el-form-item label="局长审批结果" prop="directorGeneralResult">
                  <el-select v-model="form.directorGeneralResult" disabled="true" style="width: 100%;">
                    <el-option
                      v-for="item in option_directorGeneralResult"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    ></el-option>
                  </el-select>
                  <!--<el-input v-model="form.directorGeneralResult" readonly="true" />-->
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="局长审批时间" prop="directorGeneralTime">
                  <el-date-picker
                    clearable
                    style="width: 100%"
                    v-model="form.directorGeneralTime"
                    type="date"
                    value-format="yyyy-MM-dd"
                    readonly="true">
                  </el-date-picker>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-form-item label="局长审批意见" prop="directorGeneralSuggest">
                <el-input v-model="form.directorGeneralSuggest" type="textarea" :rows="6"  readonly="true"/>
               <!-- <editor v-model="form.directorGeneralSuggest" :min-height="192" readonly="true" />-->
              </el-form-item>
            </el-row>
          </el-main>
        </el-container>
        <el-container>
          <el-header>
            <el-divider content-position="left">
              <p style="color: #00afff; font-size: 20px;">政委审核</p>
            </el-divider>
          </el-header>
          <el-main>
            <el-row>
              <el-col :span="12">
                <el-form-item label="政委审批结果" prop="politicalCommissarResult">
                  <el-select v-model="form.politicalCommissarResult" disabled="true" style="width: 100%;">
                    <el-option
                      v-for="item in option_politicalCommissarResult"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    ></el-option>
                  </el-select>
                 <!-- <el-input v-model="form.politicalCommissarResult" readonly="true" />-->
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="政委审批时间" prop="politicalCommissarTime">
                  <el-date-picker
                    clearable
                    style="width: 100%"
                    v-model="form.politicalCommissarTime"
                    type="date"
                    value-format="yyyy-MM-dd"
                    readonly="true">
                  </el-date-picker>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-form-item label="政委审批意见" prop="politicalCommissarSuggest">
                <el-input v-model="form.politicalCommissarSuggest" type="textarea" :rows="6"  readonly="true"/>
              <!--  <editor v-model="form.politicalCommissarSuggest" :min-height="192" readonly="true" />-->
              </el-form-item>
            </el-row>
          </el-main>
        </el-container>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="detailCancel">返 回</el-button>
      </div>
    </el-dialog>
    <!-- 销假审核详细休假记录对话框 -->
    <el-dialog :title="back.title" :visible.sync="back.open" width="1300px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules1" label-width="150px">
        <el-container>
          <el-header>
            <el-divider content-position="left">
              <p style="color: #00afff; font-size: 20px;">请假申请基本信息</p>
            </el-divider>
          </el-header>
          <el-main>
            <el-row>
              <el-col :span="12">
                <el-form-item label="开始时间" prop="leaveStartTime">
                  <el-date-picker
                    clearable
                    style="width: 100%"
                    v-model="form.leaveStartTime"
                    type="date"
                    value-format="yyyy-MM-dd"
                    readonly="true">
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="结束时间" prop="leaveEndTime">
                  <el-date-picker
                    clearable
                    style="width: 100%"
                    v-model="form.leaveEndTime"
                    type="date"
                    value-format="yyyy-MM-dd"
                    readonly="true">
                  </el-date-picker>
                </el-form-item>
              </el-col>
            </el-row>
            <el-form-item label="事由" prop="causes">
              <el-input v-model="form.causes" type="textarea" :rows="6"  readonly="true"/>
            </el-form-item>
            <!--<el-form-item label="休假地点" prop="leaveAddress" >
              <el-cascader
                v-model="selectedOptions"
                :options="options"
                filterable
                clearable
                style="width: 460px"
                disabled="true"
                @change="handleChange"
              />
            </el-form-item>-->
          </el-main>
        </el-container>
        <el-container>
          <el-header>
            <el-divider content-position="left">
              <p style="color: #00afff; font-size: 20px;">部门审核</p>
            </el-divider>
          </el-header>
          <el-main>
            <el-row>
              <el-col :span="12">
                <el-form-item label="部门负责人审批结果" prop="departmentHeadResult">
                  <el-select v-model="form.departmentHeadResult" disabled="true" style="width: 100%;">
                    <el-option
                      v-for="item in option_departmentHeadResult"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="部门负责人审批时间" prop="departmentHeadTime">
                  <el-date-picker
                    clearable
                    style="width: 100%"
                    v-model="form.departmentHeadTime"
                    type="date"
                    value-format="yyyy-MM-dd"
                    readonly="true">
                  </el-date-picker>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-form-item label="部门负责人审批意见" prop="departmentHeadSuggest">
                <el-input v-model="form.departmentHeadSuggest" type="textarea" :rows="6"  readonly="true"/>
                <!--  <editor v-model="form.departmentHeadSuggest" :min-height="192"   disabled="true"/>-->
              </el-form-item>
            </el-row>
          </el-main>
        </el-container>
        <el-container>
          <el-header>
            <el-divider content-position="left">
              <p style="color: #00afff; font-size: 20px;">局长审核</p>
            </el-divider>
          </el-header>
          <el-main>
            <el-row>
              <el-col :span="12">
                <el-form-item label="局长审批结果" prop="directorGeneralResult">
                  <el-select v-model="form.directorGeneralResult" disabled="true" style="width: 100%;">
                    <el-option
                      v-for="item in option_directorGeneralResult"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    ></el-option>
                  </el-select>
                  <!--<el-input v-model="form.directorGeneralResult" readonly="true" />-->
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="局长审批时间" prop="directorGeneralTime">
                  <el-date-picker
                    clearable
                    style="width: 100%"
                    v-model="form.directorGeneralTime"
                    type="date"
                    value-format="yyyy-MM-dd"
                    readonly="true">
                  </el-date-picker>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-form-item label="局长审批意见" prop="directorGeneralSuggest">
                <el-input v-model="form.directorGeneralSuggest" type="textarea" :rows="6"  readonly="true"/>
                <!-- <editor v-model="form.directorGeneralSuggest" :min-height="192" readonly="true" />-->
              </el-form-item>
            </el-row>
          </el-main>
        </el-container>
        <el-container>
          <el-header>
            <el-divider content-position="left">
              <p style="color: #00afff; font-size: 20px;">政委审核</p>
            </el-divider>
          </el-header>
          <el-main>
            <el-row>
              <el-col :span="12">
                <el-form-item label="政委审批结果" prop="politicalCommissarResult">
                  <el-select v-model="form.politicalCommissarResult" disabled="true" style="width: 100%;">
                    <el-option
                      v-for="item in option_politicalCommissarResult"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    ></el-option>
                  </el-select>
                  <!-- <el-input v-model="form.politicalCommissarResult" readonly="true" />-->
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="政委审批时间" prop="politicalCommissarTime">
                  <el-date-picker
                    clearable
                    style="width: 100%"
                    v-model="form.politicalCommissarTime"
                    type="date"
                    value-format="yyyy-MM-dd"
                    readonly="true">
                  </el-date-picker>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-form-item label="政委审批意见" prop="politicalCommissarSuggest">
                <el-input v-model="form.politicalCommissarSuggest" type="textarea" :rows="6"  readonly="true"/>
                <!--  <editor v-model="form.politicalCommissarSuggest" :min-height="192" readonly="true" />-->
              </el-form-item>
            </el-row>
          </el-main>
        </el-container>
        <el-container>
          <el-header>
            <el-divider content-position="left">
              <p style="color: #00afff; font-size: 20px;">销假信息</p>
            </el-divider>
          </el-header>
          <el-row>
            <el-form-item  prop="leaveSituation">
              <el-radio v-model="radio" label="2">确认销假</el-radio>
              <!--<el-radio-group v-model="form.leaveSituation" >
                <el-radio label="2">确认销假</el-radio>
              </el-radio-group>-->
            </el-form-item>
          </el-row>
          <el-main>
          </el-main>
        </el-container>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="backForm">确 定</el-button>
        <el-button @click="backCancel">返 回</el-button>
      </div>
    </el-dialog>
    <!-- 部门审核休假记录对话框 -->
    <el-dialog :title="view.title" :visible.sync="view.open" width="1300px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="150px">
        <el-container>
          <el-header>
            <el-divider content-position="left">
              <p style="color: #00afff; font-size: 20px;">请假申请基本信息</p>
            </el-divider>
          </el-header>
          <el-main>
            <el-row>
              <el-col :span="12">
                <el-form-item label="姓名" prop="username">
                  <el-input v-model="form.username" placeholder="请输入姓名" readonly="true"/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="部门" prop="deptId">
                  <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" disabled="true" />
                </el-form-item>
              </el-col>
            </el-row>
            <!--<el-form-item label="休假地点" prop="leaveAddress" >
              <el-cascader
                v-model="selectedOptions"
                :options="options"
                filterable
                clearable
                style="width: 1070px"
                disabled="true"
                @change="handleChange"
              />
            </el-form-item>-->
            <el-form-item label="事由" prop="causes">
              <el-input v-model="form.causes" type="textarea" :rows="6"  readonly="true"/>
            <!--  <editor v-model="form.causes" :min-height="192" readonly="true" />-->
            </el-form-item>
            <el-row>
              <el-col :span="12">
                <el-form-item label="开始时间" prop="leaveStartTime">
                  <el-date-picker
                    clearable
                    style="width: 100%"
                    v-model="form.leaveStartTime"
                    type="date"
                    readonly="true"
                    value-format="yyyy-MM-dd"
                    placeholder="请选择开始时间">
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="结束时间" prop="leaveEndTime">
                  <el-date-picker
                    clearable
                    style="width: 100%"
                    v-model="form.leaveEndTime"
                    type="date"
                    readonly="true"
                    value-format="yyyy-MM-dd"
                    placeholder="请选择结束时间">
                  </el-date-picker>
                </el-form-item>
              </el-col>
            </el-row>
          </el-main>
        </el-container>
        <el-container>
          <el-header>
            <el-divider content-position="left">
              <p style="color: #00afff; font-size: 20px;">部门审核</p>
            </el-divider>
          </el-header>
          <el-main>
            <el-row>
              <el-col :span="12">
        <el-form-item label="部门负责人审批结果" prop="departmentHeadResult">
          <el-select v-model="form.departmentHeadResult" filterable style="width: 100%;" placeholder="请选择部门负责人审批结果">
            <el-option
              v-for="item in option_departmentHeadResult"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            ></el-option>
          </el-select>
          <!--<el-input v-model="form.departmentHeadResult" placeholder="请输入部门负责人审批结果" />-->
        </el-form-item>
              </el-col>
              <el-col :span="12">
        <el-form-item label="部门负责人审批时间" prop="departmentHeadTime">
          <el-date-picker
            clearable
            style="width: 100%"
            v-model="form.departmentHeadTime"
            type="date"
            value-format="yyyy-MM-dd"
            readonly="true"
            placeholder="请选择部门负责人审批时间">
          </el-date-picker>
        </el-form-item>
              </el-col>
            </el-row>
            <el-row>
        <el-form-item label="部门负责人审批意见" prop="departmentHeadSuggest">
          <el-input v-model="form.departmentHeadSuggest" type="textarea" :rows="6"  placeholder="请输入部门负责人审批意见"/>
          <!--<editor v-model="form.departmentHeadSuggest" :min-height="150" placeholder="请输入部门负责人审批意见" />-->
        </el-form-item>
            </el-row>
            <el-row>
            <el-form-item label="代审" prop="departmentHeadIsacting">
              <el-radio-group v-model="form.departmentHeadIsacting" >
                <el-radio label="1">否</el-radio>
                <el-radio label="2">是</el-radio>
              </el-radio-group>
            </el-form-item>
            </el-row>
          </el-main>
        </el-container>
        <el-container>
              <el-header>
                <el-col :span="24" v-if="form.departmentHeadIsacting == '2'" >
                  <el-divider content-position="left">
                    <p style="color: #00afff; font-size: 20px;">代审信息
                    </p>
                  </el-divider>
                </el-col>
              </el-header>
          <el-main>
                <el-row>
                  <el-col :span="12" v-if="form.departmentHeadIsacting == '2'" >
                    <el-form-item prop="departmentHeadCharacter" label="代审标识">
                      <el-input v-model="form.departmentHeadCharacter" placeholder="请输入代审标识" />
                    </el-form-item>
                  </el-col>
                </el-row>
          </el-main>
        </el-container>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="viewForm">确 定</el-button>
        <el-button @click="viewCancel">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 局长审核休假记录对话框 -->
    <el-dialog :title="chief.title" :visible.sync="chief.open" width="1300px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="150px">
        <el-container>
          <el-header>
            <el-divider content-position="left">
              <p style="color: #00afff; font-size: 20px;">请假申请基本信息</p>
            </el-divider>
          </el-header>
          <el-main>
            <el-row>
              <el-col :span="12">
                <el-form-item label="姓名" prop="username">
                  <el-input v-model="form.username"  readonly="true"/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="部门" prop="deptId">
                  <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" disabled="true" />
                </el-form-item>
              </el-col>
            </el-row>
            <!--<el-form-item label="休假地点" prop="leaveAddress" >
              <el-cascader
                v-model="selectedOptions"
                :options="options"
                filterable
                clearable
                style="width: 1070px"
                disabled="true"
                @change="handleChange"
              />
            </el-form-item>-->
            <el-form-item label="事由" prop="causes">
              <el-input v-model="form.causes" type="textarea" :rows="6"  readonly="true"/>
             <!-- <editor v-model="form.causes" :min-height="192" readonly="true" />-->
            </el-form-item>
            <el-row>
              <el-col :span="12">
                <el-form-item label="开始时间" prop="leaveStartTime">
                  <el-date-picker
                    clearable
                    style="width: 100%"
                    v-model="form.leaveStartTime"
                    type="date"
                    readonly="true"
                    value-format="yyyy-MM-dd"
                    placeholder="请选择开始时间">
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="结束时间" prop="leaveEndTime">
                  <el-date-picker
                    clearable
                    style="width: 100%"
                    v-model="form.leaveEndTime"
                    type="date"
                    readonly="true"
                    value-format="yyyy-MM-dd"
                    placeholder="请选择结束时间">
                  </el-date-picker>
                </el-form-item>
              </el-col>
            </el-row>
          </el-main>
        </el-container>
        <el-container>
          <el-header>
            <el-divider content-position="left">
              <p style="color: #00afff; font-size: 20px;">部门审核</p>
            </el-divider>
          </el-header>
          <el-main>
            <el-row>
              <el-col :span="12">
                <el-form-item label="部门负责人审批结果" prop="departmentHeadResult">
                  <el-select v-model="form.departmentHeadResult" disabled="true" style="width: 100%;">
                    <el-option
                      v-for="item in option_departmentHeadResult"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="部门负责人审批时间" prop="departmentHeadTime">
                  <el-date-picker
                    clearable
                    style="width: 100%"
                    v-model="form.departmentHeadTime"
                    type="date"
                    value-format="yyyy-MM-dd"
                    readonly="true">
                  </el-date-picker>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-form-item label="部门负责人审批意见" prop="departmentHeadSuggest">
                <el-input v-model="form.departmentHeadSuggest" type="textarea" :rows="6"  readonly="true"/>
                <!--<editor v-model="form.departmentHeadSuggest" :min-height="192"   disabled="true"/>-->
              </el-form-item>
            </el-row>
          </el-main>
        </el-container>
        <el-container>
          <el-header>
            <el-divider content-position="left">
              <p style="color: #00afff; font-size: 20px;">局长审核</p>
            </el-divider>
          </el-header>
          <el-main>
            <el-row>
              <el-col :span="12">
                <el-form-item label="局长审批结果" prop="directorGeneralResult">
                  <el-select v-model="form.directorGeneralResult"  style="width: 100%;"   placeholder="请选择局长审批结果">
                    <el-option
                      v-for="item in option_directorGeneralResult"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    ></el-option>
                  </el-select>
               <!--   <el-input v-model="form.directorGeneralResult" placeholder="请输入局长审批结果" />-->
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="局长审批时间" prop="directorGeneralTime">
                  <el-date-picker
                    clearable
                    style="width: 100%"
                    v-model="form.directorGeneralTime"
                    type="date"
                    value-format="yyyy-MM-dd"
                    readonly="true"
                    placeholder="请选择局长审批时间">
                  </el-date-picker>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
                <el-form-item label="局长审批意见" prop="directorGeneralSuggest">
                  <el-input v-model="form.directorGeneralSuggest" type="textarea" :rows="6" placeholder="请输入局长审批意见"/>
                  <!--<editor v-model="form.directorGeneralSuggest" :min-height="192" placeholder="请输入局长审批意见" />-->
                </el-form-item>
            </el-row>
            <el-row>
              <el-form-item label="代审" prop="directorGeneralIsacting">
                <el-radio-group v-model="form.directorGeneralIsacting" >
                  <el-radio label="1">否</el-radio>
                  <el-radio label="2">是</el-radio>
                </el-radio-group>
              </el-form-item>
            </el-row>
          </el-main>
        </el-container>
            <el-container>
            <el-header>
              <el-col :span="24" v-if="form.directorGeneralIsacting == '2'" >
                <el-divider content-position="left">
                  <p style="color: #00afff; font-size: 20px;">代审信息
                  </p>
                </el-divider>
              </el-col>
            </el-header>
              <el-main>
            <el-row>
              <el-col :span="12" v-if="form.directorGeneralIsacting == '2'" >
                <el-form-item prop="directorGeneralCharacter" label="代审标识">
                  <el-input v-model="form.directorGeneralCharacter" placeholder="请输入代审标识" />
                </el-form-item>
              </el-col>
            </el-row>
          </el-main>
        </el-container>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="chiefForm">确 定</el-button>
        <el-button @click="chiefCancel">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 政委审核休假记录对话框 -->
    <el-dialog :title="gaott.title" :visible.sync="gaott.open" width="1300px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="150px">
        <el-container>
          <el-header>
            <el-divider content-position="left">
              <p style="color: #00afff; font-size: 20px;">请假申请基本信息</p>
            </el-divider>
          </el-header>
          <el-main>
            <el-row>
              <el-col :span="12">
                <el-form-item label="姓名" prop="username">
                  <el-input v-model="form.username" placeholder="请输入姓名" readonly="true"/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="部门" prop="deptId">
                  <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" disabled="true" />
                </el-form-item>
              </el-col>
            </el-row>
            <!--<el-form-item label="休假地点" prop="leaveAddress" >
              <el-cascader
                v-model="selectedOptions"
                :options="options"
                filterable
                clearable
                style="width: 1070px"
                disabled="true"
                @change="handleChange"
              />
            </el-form-item>-->
            <el-form-item label="事由" prop="causes">
              <el-input v-model="form.causes" type="textarea" :rows="6"  readonly="true"/>
             <!-- <editor v-model="form.causes" :min-height="192" readonly="true" />-->
            </el-form-item>
            <el-row>
              <el-col :span="12">
                <el-form-item label="开始时间" prop="leaveStartTime">
                  <el-date-picker
                    clearable
                    style="width: 100%"
                    v-model="form.leaveStartTime"
                    type="date"
                    readonly="true"
                    value-format="yyyy-MM-dd"
                    placeholder="请选择开始时间">
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="结束时间" prop="leaveEndTime">
                  <el-date-picker
                    clearable
                    style="width: 100%"
                    v-model="form.leaveEndTime"
                    type="date"
                    readonly="true"
                    value-format="yyyy-MM-dd"
                    placeholder="请选择结束时间">
                  </el-date-picker>
                </el-form-item>
              </el-col>
            </el-row>
          </el-main>
        </el-container>
        <el-container>
          <el-header>
            <el-divider content-position="left">
              <p style="color: #00afff; font-size: 20px;">部门审核</p>
            </el-divider>
          </el-header>
          <el-main>
            <el-row>
              <el-col :span="12">
                <el-form-item label="部门负责人审批结果" prop="departmentHeadResult">
                  <el-select v-model="form.departmentHeadResult" disabled="true" style="width: 100%;">
                    <el-option
                      v-for="item in option_departmentHeadResult"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="部门负责人审批时间" prop="departmentHeadTime">
                  <el-date-picker
                    clearable
                    style="width: 100%"
                    v-model="form.departmentHeadTime"
                    type="date"
                    value-format="yyyy-MM-dd"
                    readonly="true">
                  </el-date-picker>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-form-item label="部门负责人审批意见" prop="departmentHeadSuggest">
                <el-input v-model="form.departmentHeadSuggest" type="textarea" :rows="6"  readonly="true"/>
              <!--  <editor v-model="form.departmentHeadSuggest" :min-height="192"   disabled="true"/>-->
              </el-form-item>
            </el-row>
          </el-main>
        </el-container>
        <el-container>
          <el-header>
            <el-divider content-position="left">
              <p style="color: #00afff; font-size: 20px;">政委审核</p>
            </el-divider>
          </el-header>
          <el-main>
            <el-row>
              <el-col :span="12">
                <el-form-item label="政委审批结果" prop="politicalCommissarResult">
                  <el-select v-model="form.politicalCommissarResult"  style="width: 100%;"  placeholder="请选择政委审批结果">
                    <el-option
                      v-for="item in option_politicalCommissarResult"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    ></el-option>
                  </el-select>
                  <!--<el-input v-model="form.politicalCommissarResult" placeholder="请输入政委审批结果" />-->
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="政委审批时间" prop="politicalCommissarTime">
                  <el-date-picker
                    clearable
                    style="width: 100%"
                    v-model="form.politicalCommissarTime"
                    type="date"
                    value-format="yyyy-MM-dd"
                    readonly="true"
                    placeholder="请选择政委审批时间">
                  </el-date-picker>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
                <el-form-item label="政委审批意见" prop="politicalCommissarSuggest">
                  <el-input v-model="form.politicalCommissarSuggest" type="textarea" :rows="6" placeholder="请输入政委审批意见"/>
                  <!--<editor v-model="form.politicalCommissarSuggest" :min-height="192" placeholder="请输入政委审批意见" />-->
                </el-form-item>
            </el-row>
            <el-row>
              <el-form-item label="代审" prop="politicalCommissarIsacting">
                <el-radio-group v-model="form.politicalCommissarIsacting" >
                  <el-radio label="1">否</el-radio>
                  <el-radio label="2">是</el-radio>
                </el-radio-group>
              </el-form-item>
            </el-row>
          </el-main>
        </el-container>
        <el-container>
            <el-header>
              <el-col :span="24" v-if="form.politicalCommissarIsacting == '2'" >
                <el-divider content-position="left">
                  <p style="color: #00afff; font-size: 20px;">代审信息
                  </p>
                </el-divider>
              </el-col>
            </el-header>
          <el-main>
            <el-row>
              <el-col :span="12" v-if="form.politicalCommissarIsacting == '2'" >
                <el-form-item prop="politicalCommissarCharacter" label="代审标识">
                  <el-input v-model="form.politicalCommissarCharacter" placeholder="请输入代审标识" />
                </el-form-item>
              </el-col>
            </el-row>
          </el-main>
        </el-container>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="gaottForm">确 定</el-button>
        <el-button @click="gaottCancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listLeave, getLeave, delLeave, addLeave, updateLeave, viewLeave,chiefLeave, gaottLeave, getPhone, getDirector, getCommissor,backLeave} from "@/api/module/cjl/leave";
import { treeselect } from "@/api/system/dept";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import watermark from "watermark-dom";
// 导入省市区数据组件
import { provinceAndCityData,CodeToText, TextToCode } from 'element-china-area-data'
export default {
  name: "Leave",
  components: { Treeselect },
  dicts: ['yh_leave_situation'],
  data() {
    return {
      radio:'2',
      option_departmentHeadResult: [{
        value: '1',
        label: '通过'
      }, {
        value: '2',
        label: '不通过'
      }],
      option_directorGeneralResult: [{
        value: '1',
        label: '通过'
      }, {
        value: '2',
        label: '不通过'
      }],
      option_politicalCommissarResult: [{
        value: '1',
        label: '通过'
      }, {
        value: '2',
        label: '不通过'
      }],
      option_leaveTotalState: [{
        value: '0',
        label: '审核不通过'
      }, {
        value: '1',
        label: '待部门审核'
      },{
        value: '2',
        label: '待局长政委审核'
      },
        {
        value: '4',
        label: '已审核'
      }],
      //城市选项
      options: provinceAndCityData,
      selectedOptions: [],
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: false,
      // 总条数
      total: 0,
      // 休假记录表格数据
      leaveList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        department: null,
        username: null,
        idNumber: null,
        deptid: null,
        causes: null,
        leaveStartTime: null,
        leaveEndTime: null,
        leaveSituation: null,
        leaveAddress: null,
        userId: null,
        deptId: null,
        departmentHeadName: null,
        departmentHeadIdnum: null,
        departmentHeadResult: null,
        departmentHeadTime: null,
        departmentHeadSuggest: null,
        departmentHeadIsacting: null,
        departmentHeadCharacter: null,
        directorGeneralName: null,
        directorGeneralIdnum: null,
        directorGeneralResult: null,
        directorGeneralTime: null,
        directorGeneralSuggest: null,
        directorGeneralIsacting: null,
        directorGeneralCharacter: null,
        politicalCommissarName: null,
        politicalCommissarIdnum: null,
        politicalCommissarResult: null,
        politicalCommissarTime: null,
        politicalCommissarSuggest: null,
        politicalCommissarIsacting: null,
        politicalCommissarCharacter: null,
        leaveTotalState: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null,
        note6: null,
        note7: null,
        note8: null,
        note9: null,
        note10: null
      },
      // 表单参数
      form: {
        departmentHeadTime:this.getNowTime(),
        directorGeneralTime:this.getNowTime(),
        politicalCommissarTime:this.getNowTime()
      },
      // 查看审核查询参数
      detail:{
        // 是否显示弹出层（用户查询）
        open: false,
        // 弹出层标题（用户查询）
        title: "",
      },
      // 销假审核查询参数
      back:{
        // 是否显示弹出层（用户查询）
        open: false,
        // 弹出层标题（用户查询）
        title: "",
      },
      // 部门审核查询参数
      view:{
        // 是否显示弹出层（用户查询）
        open: false,
        // 弹出层标题（用户查询）
        title: "",
      },
      // 局长审核查询参数
      chief:{
        // 是否显示弹出层（用户查询）
        open: false,
        // 弹出层标题（用户查询）
        title: "",
      },
      // 政委审核查询参数
      gaott:{
        // 是否显示弹出层（用户查询）
        open: false,
        // 弹出层标题（用户查询）
        title: "",
      },
     /* // 列信息
      columns: [
        { key: 0, label: `姓名`, visible: true },
        { key: 1, label: `身份证号`, visible: false },
        { key: 2, label: `部门`, visible: true },
        { key: 3, label: `事由`, visible: false},
        { key: 4, label: `开始时间`, visible: false},
        { key: 5, label: `结束时间`, visible: false },
        { key: 6, label: `销假情况`, visible: false },
        { key: 7, label: `部门负责人姓名`, visible: false},
        { key: 8, label: `部门负责人身份证号`, visible: false },
        { key: 9, label: `负责人审批结果`, visible: true},
        { key: 10, label: `部门负责人审批时间`, visible: false },
        { key: 11, label: `部门负责人审批意见`, visible: false },
        { key: 12, label: `部门负责人是否代审`, visible: false },
        { key: 13, label: `局长姓名`, visible: false },
        { key: 14, label: `局长身份证号`, visible: false },
        { key: 15, label: `局长审批结果`, visible: true },
        { key: 16, label: `局长审批时间`, visible: false },
        { key: 17, label: `局长审批意见`, visible: false},
        { key: 18, label: `局长是否代审`, visible: false },
        { key: 19, label: `政委姓名`, visible: false},
        { key: 20, label: `政委身份证号`, visible: false},
        { key: 21, label: `政委审批结果`, visible: true},
        { key: 22, label: `政委审批时间`, visible: false},
        { key: 23, label: `政委审批意见`, visible: false},
        { key: 24, label: `政委是否代审`, visible: false},
        { key: 25, label: `休假审核总状态`, visible: true }
      ],*/
      // 表单校验
      rules1: {
        leaveSituation: [
          { required: true, message: "销假不能为空", trigger: "blur" },
        ],
      },
      rules: {
        leaveStartTime: [
          { required: true, message: "开始时间不能为空", trigger: "blur" },
        ],
        leaveEndTime: [
          { required: true, message: "结束时间不能为空", trigger: "blur" },
        ],
        causes: [
          { required: true, message: "备注不能为空", trigger: "blur" },
        ],
        departmentHeadResult: [
          { required: true, message: "审批意见不能为空", trigger: "blur" },
        ],
        directorGeneralResult: [
          { required: true, message: "审批意见不能为空", trigger: "blur" },
        ],
        politicalCommissarResult: [
          { required: true, message: "审批意见不能为空", trigger: "blur" },
        ],
        departmentHeadCharacter: [
          { required: true, message: "代审标识不能为空", trigger: "blur" },
        ],
        directorGeneralIsacting: [
          { required: true, message: "代审不能为空", trigger: "blur" },
        ],
        departmentHeadIsacting: [
          { required: true, message: "代审不能为空", trigger: "blur" },
        ],
        politicalCommissarIsacting: [
          { required: true, message: "代审不能为空", trigger: "blur" },
        ],
        directorGeneralCharacter: [
          { required: true, message: "代审标识不能为空", trigger: "blur" },
        ],
        politicalCommissarCharacter: [
          { required: true, message: "代审标识不能为空", trigger: "blur" },
        ],
        leaveAddress: [
          { required: true, message: "休假地点不能为空", trigger: "blur" },
        ],
      }
    };
  },
  mounted() {
    watermark.load({ watermark_txt: "  "   });
  },
  created() {
    this.getList();
    this.getTreeselect();
    this.getNowTime();
  },
  methods: {
    indexMethod(index) {
      index = (index + 1) + (this.queryParams.pageNum - 1) * this.queryParams.pageSize
      return index
    },
    /*handleChange (value) {
      console.log(value)
      this.getCodeToText(null,value)
    },
    getCodeToText (codeStr, codeArray) {
      if (null === codeStr && null === codeArray) {
        return null;
      } else if (null === codeArray) {
        codeArray = codeStr.split(",");
      }
      let leaveAddress = "";
      switch (codeArray.length) {
        case 1:
          leaveAddress += CodeToText[codeArray[0]];
          break;
        case 2:
          leaveAddress += CodeToText[codeArray[0]] + "/" + CodeToText[codeArray[1]];
          break;
        default:
          break;
      }
      this.form.leaveAddress = leaveAddress
      return leaveAddress;
    },*/
    getNowTime() {
      var now = new Date();
      var year = now.getFullYear(); //得到年份
      var month = now.getMonth(); //得到月份
      var date = now.getDate(); //得到日期
      month = month + 1;
      month = month.toString().padStart(2, "0");
      date = date.toString().padStart(2, "0");
      var defaultDate = `${year}-${month}-${date}`;
      return defaultDate;
    },
    /** 查询休假记录列表 */
    getList() {
      this.loading = true;
      listLeave(this.queryParams).then(response => {
        this.leaveList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    /** 查询部门下拉树结构 */
    getTreeselect() {
      treeselect().then(response => {
        this.deptOptions = response.data;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 取消按钮
    detailCancel() {
      this.detail.open = false;
      this.reset();
    },
    // 取消按钮
    backCancel(){
      this.back.open = false;
      this.reset();
    },
    // 取消按钮
    viewCancel() {
      this.view.open = false;
      this.reset();
    },
    // 取消按钮
    chiefCancel() {
      this.chief.open = false;
      this.reset();
    },
    // 取消按钮
    gaottCancel() {
      this.gaott.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        department: null,
        username: null,
        idNumber: null,
        deptid: null,
        causes: null,
        leaveStartTime: null,
        leaveEndTime: null,
        leaveSituation: null,
        leaveAddress: null,
        userId: null,
        deptId: null,
        departmentHeadName: null,
        departmentHeadIdnum: null,
        departmentHeadResult: null,
        departmentHeadTime: null,
        departmentHeadSuggest: null,
        departmentHeadIsacting: null,
        departmentHeadCharacter: null,
        directorGeneralName: null,
        directorGeneralIdnum: null,
        directorGeneralResult: null,
        directorGeneralTime: null,
        directorGeneralSuggest: null,
        directorGeneralIsacting: null,
        directorGeneralCharacter: null,
        politicalCommissarName: null,
        politicalCommissarIdnum: null,
        politicalCommissarResult: null,
        politicalCommissarTime: null,
        politicalCommissarSuggest: null,
        politicalCommissarIsacting: null,
        politicalCommissarCharacter: null,
        leaveTotalState: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null,
        note6: null,
        note7: null,
        note8: null,
        note9: null,
        note10: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.is=selection.map(item => item.username)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.selectedOptions=[];
      this.open = true;
      this.title = "添加请假记录";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getLeave(id).then(response => {
        this.form = response.data;
        /*this.selectedOptions = TextToCode[this.form.leaveAddress.split('/')[0]][this.form.leaveAddress.split('/')[1]].code;*/
        this.open = true;
        this.title = "修改请假记录";

      });
    },

    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateLeave(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addLeave(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 销假按钮 */
    backForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            backLeave(this.form).then(response => {
              this.$modal.msgSuccess("提交成功");
              this.back.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 部门审核按钮 */
    viewForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            viewLeave(this.form).then(response => {
              this.$modal.msgSuccess("提交成功");
              this.view.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 局长审核按钮 */
    chiefForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            chiefLeave(this.form).then(response => {
              this.$modal.msgSuccess("提交成功");
              this.chief.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 政委审核按钮 */
    gaottForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            gaottLeave(this.form).then(response => {
              this.$modal.msgSuccess("提交成功");
              this.gaott.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 详细按钮操作 */
    handleDetail(row) {
      /*const id = row.id || this.ids
      getLeave(id).then(response => {
        this.form = response.data;
        /!*this.selectedOptions = TextToCode[this.form.leaveAddress.split('/')[0]][this.form.leaveAddress.split('/')[1]].code;*!/
        if(this.form.leaveTotalState==1){
          this.form.departmentHeadTime=null;
          this.form.directorGeneralTime=null;
          this.form.politicalCommissarTime=null;
        }
        this.detail.open = true;
        this.detail.title = "请假申请详细";
      });*/
      const id = row.id;
      this.$router.push({ path:"/zonghe/leave_detail", query: {id}});
    },
    /** 销假按钮操作 */
    handleBack(row) {
      const id = row.id || this.ids
      getLeave(id).then(response => {
        this.form = response.data;
        /*this.selectedOptions = TextToCode[this.form.leaveAddress.split('/')[0]][this.form.leaveAddress.split('/')[1]].code;*/
        if(this.form.leaveTotalState==1){
          this.form.departmentHeadTime=null;
          this.form.directorGeneralTime=null;
          this.form.politicalCommissarTime=null;
        }
        this.back.open = true;
        this.back.title = "销假详细";
      });
    },
    /** 部门详细按钮操作 */
    handleView(row) {
      const id = row.id || this.ids
      getPhone(id).then(response => {
      });
      getLeave(id).then(response => {
        this.form = response.data;
        /*this.selectedOptions = TextToCode[this.form.leaveAddress.split('/')[0]][this.form.leaveAddress.split('/')[1]].code;*/
        this.form.departmentHeadTime=this.getNowTime();
        this.form.departmentHeadCharacter=null;
        this.view.open = true;
        this.view.title = "审核请假申请";
      });
    },
    /** 局长详细按钮操作 */
    handleChief(row) {
      getDirector().then(response => {
      });
      const id = row.id || this.ids
      getLeave(id).then(response => {
        this.form = response.data;
        /*this.selectedOptions = TextToCode[this.form.leaveAddress.split('/')[0]][this.form.leaveAddress.split('/')[1]].code;*/
        this.form.directorGeneralTime=this.getNowTime();
        this.form.directorGeneralCharacter=null;
        this.chief.open = true;
        this.chief.title = "审核请假申请";
      });
    },
    /** 政委详细按钮操作 */
    handleGaott(row) {
      getCommissor().then(response => {
      });
      const id = row.id || this.ids
      getLeave(id).then(response => {
        this.form = response.data;
        /*this.selectedOptions = TextToCode[this.form.leaveAddress.split('/')[0]][this.form.leaveAddress.split('/')[1]].code;*/
        this.form.politicalCommissarTime=this.getNowTime();
        this.form.politicalCommissarCharacter=null;
        this.gaott.open = true;
        this.gaott.title = "审核请假申请";
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      const i=row.username || this.is;
      this.$modal.confirm('是否确认删除姓名为"' + i + '"的数据项？').then(function() {
        return delLeave(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('module/cjl/leave/export', {
        ...this.queryParams
      }, `leave_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
<style>
  .el-header, .el-footer {
    background-color: #FFFFFF;
    color: #333;
    text-align: left;
    line-height: 60px;
    font-style: oblique;

  }

  .el-aside {
    background-color: #D3DCE6;
    color: #333;
    text-align: center;
    line-height: 200px;
  }
  body > .el-container {
    margin-bottom: 40px;
  }

  .el-container:nth-child(5) .el-aside,
  .el-container:nth-child(6) .el-aside {
    line-height: 260px;
  }

  .el-container:nth-child(7) .el-aside {
    line-height: 320px;
  }

  /*对话框标题样式*/
  .el-dialog__title{
    /*color: #1ab394;*/
    font-weight: bold;
    font-size: 25px;
  }

</style>
